package com.jai.pms.message.service;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.RemotePmsService;
import com.ruoyi.system.api.model.Project;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class ShotService {
    private static final Logger logger = LoggerFactory.getLogger(ShotService.class);

    @Autowired
    private RemotePmsService remotePmsService;

    public boolean onMessage(String method, String id) {
        logger.info("ShotService done：method = {}, id = {}", method, id);
        R<Project> projectResult = remotePmsService.getProject(101L, SecurityConstants.INNER);
        if (StringUtils.isNull(projectResult) || StringUtils.isNull(projectResult.getData()))
        {
        }
        if (R.FAIL == projectResult.getCode())
        {
            throw new ServiceException(projectResult.getMsg());
        }

        Project project = projectResult.getData();
        logger.info(project.getName());
        return true;
    }
}
